package com.erlin.store.controller;


import com.erlin.store.controller.param.StoreRegisterParam;
import com.erlin.store.controller.vo.StoreInfoVo;
import com.erlin.store.service.IStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author alin
 * @since 2021-05-25
 */
@RestController
@RequestMapping("/store")
@Api(tags = "商户")
public class StoreController {
    @Autowired
    private IStoreService storeService;
    @PostMapping("/register")
    @ApiOperation("商户注册")
    public StoreInfoVo register(@RequestBody @Validated StoreRegisterParam param){
        return storeService.register(param);
    }

    @GetMapping("/myStores")
    @ApiOperation("获取当前用户下所有的商户信息")
    public List<StoreInfoVo> myStores(){
        return storeService.searchOwnerStores();
    }
}
